\(\int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx\) [152]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 33, antiderivative size = 48 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=-\frac {a \sqrt {1-d^2 x^2}}{x}+\frac {c \arcsin (d x)}{d}-b \text {arctanh}\left (\sqrt {1-d^2 x^2}\right ) \]

[Out]

c*arcsin(d*x)/d-b*arctanh((-d^2*x^2+1)^(1/2))-a*(-d^2*x^2+1)^(1/2)/x

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.212, Rules used = {1623, 1821, 858, 222, 272, 65, 214} \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=-\frac {a \sqrt {1-d^2 x^2}}{x}+\frac {c \arcsin (d x)}{d}-b \text {arctanh}\left (\sqrt {1-d^2 x^2}\right ) \]

[In]

Int[(a + b*x + c*x^2)/(x^2*Sqrt[1 - d*x]*Sqrt[1 + d*x]),x]

[Out]

-((a*Sqrt[1 - d^2*x^2])/x) + (c*ArcSin[d*x])/d - b*ArcTanh[Sqrt[1 - d^2*x^2]]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 222

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSin[Rt[-b, 2]*(x/Sqrt[a])]/Rt[-b, 2], x] /; FreeQ[{a, b}
, x] && GtQ[a, 0] && NegQ[b]

Rule 272

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a
+ b*x)^p, x], x, x^n], x] /; FreeQ[{a, b, m, n, p}, x] && IntegerQ[Simplify[(m + 1)/n]]

Rule 858

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Dist[g/e, Int[(d
+ e*x)^(m + 1)*(a + c*x^2)^p, x], x] + Dist[(e*f - d*g)/e, Int[(d + e*x)^m*(a + c*x^2)^p, x], x] /; FreeQ[{a,
c, d, e, f, g, m, p}, x] && NeQ[c*d^2 + a*e^2, 0] &&  !IGtQ[m, 0]

Rule 1623

Int[(Px_)*((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[P
x*(a*c + b*d*x^2)^m*(e + f*x)^p, x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && PolyQ[Px, x] && EqQ[b*c + a*d,
 0] && EqQ[m, n] && (IntegerQ[m] || (GtQ[a, 0] && GtQ[c, 0]))

Rule 1821

Int[(Pq_)*((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[Pq, c*x, x],
 R = PolynomialRemainder[Pq, c*x, x]}, Simp[R*(c*x)^(m + 1)*((a + b*x^2)^(p + 1)/(a*c*(m + 1))), x] + Dist[1/(
a*c*(m + 1)), Int[(c*x)^(m + 1)*(a + b*x^2)^p*ExpandToSum[a*c*(m + 1)*Q - b*R*(m + 2*p + 3)*x, x], x], x]] /;
FreeQ[{a, b, c, p}, x] && PolyQ[Pq, x] && LtQ[m, -1] && (IntegerQ[2*p] || NeQ[Expon[Pq, x], 1])

Rubi steps \begin{align*} \text {integral}& = \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d^2 x^2}} \, dx \\ & = -\frac {a \sqrt {1-d^2 x^2}}{x}-\int \frac {-b-c x}{x \sqrt {1-d^2 x^2}} \, dx \\ & = -\frac {a \sqrt {1-d^2 x^2}}{x}+b \int \frac {1}{x \sqrt {1-d^2 x^2}} \, dx+c \int \frac {1}{\sqrt {1-d^2 x^2}} \, dx \\ & = -\frac {a \sqrt {1-d^2 x^2}}{x}+\frac {c \sin ^{-1}(d x)}{d}+\frac {1}{2} b \text {Subst}\left (\int \frac {1}{x \sqrt {1-d^2 x}} \, dx,x,x^2\right ) \\ & = -\frac {a \sqrt {1-d^2 x^2}}{x}+\frac {c \sin ^{-1}(d x)}{d}-\frac {b \text {Subst}\left (\int \frac {1}{\frac {1}{d^2}-\frac {x^2}{d^2}} \, dx,x,\sqrt {1-d^2 x^2}\right )}{d^2} \\ & = -\frac {a \sqrt {1-d^2 x^2}}{x}+\frac {c \sin ^{-1}(d x)}{d}-b \tanh ^{-1}\left (\sqrt {1-d^2 x^2}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.21 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.52 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=-\frac {a \sqrt {1-d^2 x^2}}{x}+\frac {2 c \arctan \left (\frac {d x}{-1+\sqrt {1-d^2 x^2}}\right )}{d}-b \log (x)+b \log \left (-1+\sqrt {1-d^2 x^2}\right ) \]

[In]

Integrate[(a + b*x + c*x^2)/(x^2*Sqrt[1 - d*x]*Sqrt[1 + d*x]),x]

[Out]

-((a*Sqrt[1 - d^2*x^2])/x) + (2*c*ArcTan[(d*x)/(-1 + Sqrt[1 - d^2*x^2])])/d - b*Log[x] + b*Log[-1 + Sqrt[1 - d
^2*x^2]]

Maple [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 1.60 (sec) , antiderivative size = 97, normalized size of antiderivative = 2.02

method result size
default \(\frac {\left (-\operatorname {arctanh}\left (\frac {1}{\sqrt {-d^{2} x^{2}+1}}\right ) \operatorname {csgn}\left (d \right ) d b x -\sqrt {-d^{2} x^{2}+1}\, \operatorname {csgn}\left (d \right ) d a +\arctan \left (\frac {\operatorname {csgn}\left (d \right ) d x}{\sqrt {-d^{2} x^{2}+1}}\right ) c x \right ) \sqrt {-d x +1}\, \sqrt {d x +1}\, \operatorname {csgn}\left (d \right )}{\sqrt {-d^{2} x^{2}+1}\, x d}\) \(97\)
risch \(\frac {a \sqrt {d x +1}\, \left (d x -1\right ) \sqrt {\left (-d x +1\right ) \left (d x +1\right )}}{x \sqrt {-\left (d x +1\right ) \left (d x -1\right )}\, \sqrt {-d x +1}}+\frac {\left (\frac {c \arctan \left (\frac {\sqrt {d^{2}}\, x}{\sqrt {-d^{2} x^{2}+1}}\right )}{\sqrt {d^{2}}}-b \,\operatorname {arctanh}\left (\frac {1}{\sqrt {-d^{2} x^{2}+1}}\right )\right ) \sqrt {\left (-d x +1\right ) \left (d x +1\right )}}{\sqrt {-d x +1}\, \sqrt {d x +1}}\) \(129\)

[In]

int((c*x^2+b*x+a)/x^2/(-d*x+1)^(1/2)/(d*x+1)^(1/2),x,method=_RETURNVERBOSE)

[Out]

(-arctanh(1/(-d^2*x^2+1)^(1/2))*csgn(d)*d*b*x-(-d^2*x^2+1)^(1/2)*csgn(d)*d*a+arctan(csgn(d)*d*x/(-d^2*x^2+1)^(
1/2))*c*x)*(-d*x+1)^(1/2)*(d*x+1)^(1/2)*csgn(d)/(-d^2*x^2+1)^(1/2)/x/d

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.75 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=\frac {b d x \log \left (\frac {\sqrt {d x + 1} \sqrt {-d x + 1} - 1}{x}\right ) - \sqrt {d x + 1} \sqrt {-d x + 1} a d - 2 \, c x \arctan \left (\frac {\sqrt {d x + 1} \sqrt {-d x + 1} - 1}{d x}\right )}{d x} \]

[In]

integrate((c*x^2+b*x+a)/x^2/(-d*x+1)^(1/2)/(d*x+1)^(1/2),x, algorithm="fricas")

[Out]

(b*d*x*log((sqrt(d*x + 1)*sqrt(-d*x + 1) - 1)/x) - sqrt(d*x + 1)*sqrt(-d*x + 1)*a*d - 2*c*x*arctan((sqrt(d*x +
 1)*sqrt(-d*x + 1) - 1)/(d*x)))/(d*x)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 28.14 (sec) , antiderivative size = 221, normalized size of antiderivative = 4.60 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=\frac {i a d {G_{6, 6}^{5, 3}\left (\begin {matrix} \frac {5}{4}, \frac {7}{4}, 1 & \frac {3}{2}, \frac {3}{2}, 2 \\1, \frac {5}{4}, \frac {3}{2}, \frac {7}{4}, 2 & 0 \end {matrix} \middle | {\frac {1}{d^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}}} + \frac {a d {G_{6, 6}^{2, 6}\left (\begin {matrix} \frac {1}{2}, \frac {3}{4}, 1, \frac {5}{4}, \frac {3}{2}, 1 & \\\frac {3}{4}, \frac {5}{4} & \frac {1}{2}, 1, 1, 0 \end {matrix} \middle | {\frac {e^{- 2 i \pi }}{d^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}}} + \frac {i b {G_{6, 6}^{5, 3}\left (\begin {matrix} \frac {3}{4}, \frac {5}{4}, 1 & 1, 1, \frac {3}{2} \\\frac {1}{2}, \frac {3}{4}, 1, \frac {5}{4}, \frac {3}{2} & 0 \end {matrix} \middle | {\frac {1}{d^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}}} - \frac {b {G_{6, 6}^{2, 6}\left (\begin {matrix} 0, \frac {1}{4}, \frac {1}{2}, \frac {3}{4}, 1, 1 & \\\frac {1}{4}, \frac {3}{4} & 0, \frac {1}{2}, \frac {1}{2}, 0 \end {matrix} \middle | {\frac {e^{- 2 i \pi }}{d^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}}} - \frac {i c {G_{6, 6}^{6, 2}\left (\begin {matrix} \frac {1}{4}, \frac {3}{4} & \frac {1}{2}, \frac {1}{2}, 1, 1 \\0, \frac {1}{4}, \frac {1}{2}, \frac {3}{4}, 1, 0 & \end {matrix} \middle | {\frac {1}{d^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} d} + \frac {c {G_{6, 6}^{2, 6}\left (\begin {matrix} - \frac {1}{2}, - \frac {1}{4}, 0, \frac {1}{4}, \frac {1}{2}, 1 & \\- \frac {1}{4}, \frac {1}{4} & - \frac {1}{2}, 0, 0, 0 \end {matrix} \middle | {\frac {e^{- 2 i \pi }}{d^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} d} \]

[In]

integrate((c*x**2+b*x+a)/x**2/(-d*x+1)**(1/2)/(d*x+1)**(1/2),x)

[Out]

I*a*d*meijerg(((5/4, 7/4, 1), (3/2, 3/2, 2)), ((1, 5/4, 3/2, 7/4, 2), (0,)), 1/(d**2*x**2))/(4*pi**(3/2)) + a*
d*meijerg(((1/2, 3/4, 1, 5/4, 3/2, 1), ()), ((3/4, 5/4), (1/2, 1, 1, 0)), exp_polar(-2*I*pi)/(d**2*x**2))/(4*p
i**(3/2)) + I*b*meijerg(((3/4, 5/4, 1), (1, 1, 3/2)), ((1/2, 3/4, 1, 5/4, 3/2), (0,)), 1/(d**2*x**2))/(4*pi**(
3/2)) - b*meijerg(((0, 1/4, 1/2, 3/4, 1, 1), ()), ((1/4, 3/4), (0, 1/2, 1/2, 0)), exp_polar(-2*I*pi)/(d**2*x**
2))/(4*pi**(3/2)) - I*c*meijerg(((1/4, 3/4), (1/2, 1/2, 1, 1)), ((0, 1/4, 1/2, 3/4, 1, 0), ()), 1/(d**2*x**2))
/(4*pi**(3/2)*d) + c*meijerg(((-1/2, -1/4, 0, 1/4, 1/2, 1), ()), ((-1/4, 1/4), (-1/2, 0, 0, 0)), exp_polar(-2*
I*pi)/(d**2*x**2))/(4*pi**(3/2)*d)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.19 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=-b \log \left (\frac {2 \, \sqrt {-d^{2} x^{2} + 1}}{{\left | x \right |}} + \frac {2}{{\left | x \right |}}\right ) + \frac {c \arcsin \left (d x\right )}{d} - \frac {\sqrt {-d^{2} x^{2} + 1} a}{x} \]

[In]

integrate((c*x^2+b*x+a)/x^2/(-d*x+1)^(1/2)/(d*x+1)^(1/2),x, algorithm="maxima")

[Out]

-b*log(2*sqrt(-d^2*x^2 + 1)/abs(x) + 2/abs(x)) + c*arcsin(d*x)/d - sqrt(-d^2*x^2 + 1)*a/x

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 282 vs. \(2 (44) = 88\).

Time = 0.40 (sec) , antiderivative size = 282, normalized size of antiderivative = 5.88 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=-\frac {\frac {4 \, a d^{2} {\left (\frac {\sqrt {2} - \sqrt {-d x + 1}}{\sqrt {d x + 1}} - \frac {\sqrt {d x + 1}}{\sqrt {2} - \sqrt {-d x + 1}}\right )}}{{\left (\frac {\sqrt {2} - \sqrt {-d x + 1}}{\sqrt {d x + 1}} - \frac {\sqrt {d x + 1}}{\sqrt {2} - \sqrt {-d x + 1}}\right )}^{2} - 4} + b d \log \left ({\left | -\frac {\sqrt {2} - \sqrt {-d x + 1}}{\sqrt {d x + 1}} + \frac {\sqrt {d x + 1}}{\sqrt {2} - \sqrt {-d x + 1}} + 2 \right |}\right ) - b d \log \left ({\left | -\frac {\sqrt {2} - \sqrt {-d x + 1}}{\sqrt {d x + 1}} + \frac {\sqrt {d x + 1}}{\sqrt {2} - \sqrt {-d x + 1}} - 2 \right |}\right ) - {\left (\pi + 2 \, \arctan \left (\frac {\sqrt {d x + 1} {\left (\frac {{\left (\sqrt {2} - \sqrt {-d x + 1}\right )}^{2}}{d x + 1} - 1\right )}}{2 \, {\left (\sqrt {2} - \sqrt {-d x + 1}\right )}}\right )\right )} c}{d} \]

[In]

integrate((c*x^2+b*x+a)/x^2/(-d*x+1)^(1/2)/(d*x+1)^(1/2),x, algorithm="giac")

[Out]

-(4*a*d^2*((sqrt(2) - sqrt(-d*x + 1))/sqrt(d*x + 1) - sqrt(d*x + 1)/(sqrt(2) - sqrt(-d*x + 1)))/(((sqrt(2) - s
qrt(-d*x + 1))/sqrt(d*x + 1) - sqrt(d*x + 1)/(sqrt(2) - sqrt(-d*x + 1)))^2 - 4) + b*d*log(abs(-(sqrt(2) - sqrt
(-d*x + 1))/sqrt(d*x + 1) + sqrt(d*x + 1)/(sqrt(2) - sqrt(-d*x + 1)) + 2)) - b*d*log(abs(-(sqrt(2) - sqrt(-d*x
 + 1))/sqrt(d*x + 1) + sqrt(d*x + 1)/(sqrt(2) - sqrt(-d*x + 1)) - 2)) - (pi + 2*arctan(1/2*sqrt(d*x + 1)*((sqr
t(2) - sqrt(-d*x + 1))^2/(d*x + 1) - 1)/(sqrt(2) - sqrt(-d*x + 1))))*c)/d

Mupad [B] (verification not implemented)

Time = 4.08 (sec) , antiderivative size = 114, normalized size of antiderivative = 2.38 \[ \int \frac {a+b x+c x^2}{x^2 \sqrt {1-d x} \sqrt {1+d x}} \, dx=b\,\left (\ln \left (\frac {{\left (\sqrt {1-d\,x}-1\right )}^2}{{\left (\sqrt {d\,x+1}-1\right )}^2}-1\right )-\ln \left (\frac {\sqrt {1-d\,x}-1}{\sqrt {d\,x+1}-1}\right )\right )-\frac {4\,c\,\mathrm {atan}\left (\frac {d\,\left (\sqrt {1-d\,x}-1\right )}{\left (\sqrt {d\,x+1}-1\right )\,\sqrt {d^2}}\right )}{\sqrt {d^2}}-\frac {a\,\sqrt {1-d\,x}\,\sqrt {d\,x+1}}{x} \]

[In]

int((a + b*x + c*x^2)/(x^2*(1 - d*x)^(1/2)*(d*x + 1)^(1/2)),x)

[Out]

b*(log(((1 - d*x)^(1/2) - 1)^2/((d*x + 1)^(1/2) - 1)^2 - 1) - log(((1 - d*x)^(1/2) - 1)/((d*x + 1)^(1/2) - 1))
) - (4*c*atan((d*((1 - d*x)^(1/2) - 1))/(((d*x + 1)^(1/2) - 1)*(d^2)^(1/2))))/(d^2)^(1/2) - (a*(1 - d*x)^(1/2)
*(d*x + 1)^(1/2))/x